<html>
<head>
	<!--<LINK href="style/template.php" rel="stylesheet" type="text/css">-->
	<LINK href="style/bootstrap.css" rel="stylesheet" type="text/css">
	<LINK href="style/tempstrap.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
//require_once("lib/auth/session.php");//session call is probably only needed in lib/ files
//require_once("lib/post/view.php");
//require_once("lib/comment/view.php");
require_once("library/curl.php");
require_once("resources/const.php");


// $postid = '0';
// $postid = $_GET['postid'];  
// $post = getPost($postid);
function drawPost ($content) {
	if ($content['status'] != "ok") {
		echo $content['details'];
	} else {
		$post = $content['posts'];
		require("modules/post.php");
	}
	
}

function drawComments ($content) {
	if ($content['status'] != "ok") {
		echo $content['details'];
	} else {
		$commentArr = $content['comments'];
		foreach ($commentArr as $comment) {
			require("modules/comment.php");
		}
	}
	require("modules/createComment.php");
	
}

require_once("modules/contentWrap.php");
beforeContent();

$curl = new curlHelper();
$curl->addHandle($BACKEND_URL."/api/post/view.php" ,"drawPost", 
    array("postid"=>$_GET['postid']));
$curl->exec();
$curl = new curlHelper();
$curl->addHandle($BACKEND_URL."/api/comment/view.php", "drawComments",
    array("postid"=>$_GET['postid']));
$curl->exec();

afterContent();
?>


